Like draw_sprite, but the picture curves away from you, as if it were wrapped round a barrel or tipped back like a sign: the top and bottom of it shrink back and the middle stays full size. shape picks the look: SPRITE_BULGE, SPRITE_LEAN_BACK and SPRITE_LEAN_FORWARD choose which part of the picture shrinks, and SPRITE_DRUM fixes a lens on the middle of the screen and the sprite slides through it. depth says how much, from 1 to 3 (1 is gentle, 3 is deep); for SPRITE_DRUM it is how tight the lens is, from 1 to 6. 0 draws the sprite flat.
Works differently on Game Boy - The Game Boy narrows the picture on some lines by moving its two sprite pieces toward each other (the middle is covered, not squeezed), a drum or a band hides it outside the lens; 16 pixels wide at most, one picture at a time; the size is not used.
Works differently on Game Boy Color - The Game Boy Color narrows the picture on some lines by moving its two sprite pieces toward each other (the middle is covered, not squeezed), a drum or a band hides it outside the lens; 16 pixels wide at most, one picture at a time; the size is not used.
Sega Genesis: not available
On other consoles this differs: see Side by side and How the consoles differ.
draw_sprite_3d(spr, x, y, frame, shape, depth)| Name | Type |
|---|---|
spr | sprite |
x | real |
y | real |
frame | int |
shape | sprite_shape |
depth | int |
Nothing.
Draws a sprite that curves away from you, as if it were wrapped round a barrel or tipped back like a sign. The top and bottom of the picture shrink back and the middle stays full size. It is draw_sprite with a third dimension, and it does for a sprite what draw_text_3d does for a line of text.


Left to right: a flat draw_sprite, then the same sprite with SPRITE_BULGE, SPRITE_LEAN_BACK and SPRITE_LEAN_FORWARD, all at depth 3. A tall striped lighthouse stands in for the example's spr_doc_tower, because a curve is much easier to see on something tall: the calls and the numbers are the same. (The console can only do two of these at once, see "What it costs" below, so the four pictures are four different moments, cut out and put side by side.) Real pictures from a Game Boy Advance ROM.
x and y are a place in the room, counted from the room's top-left corner, and the sprite is drawn with its origin on that spot, exactly like draw_sprite. It is cached the same way too: call it every frame the sprite should stay on screen, and stop calling it to let it go.
shape says which part of the picture shrinks away:
SPRITE_BULGE - the middle stays big, the top and the bottom both shrink. Like a picture on a barrel.SPRITE_LEAN_BACK - the bottom stays big, the top shrinks. Like a sign tipped back, so the top edge is farther from you.SPRITE_LEAN_FORWARD - the top stays big, the bottom shrinks.SPRITE_DRUM - not a curve on the picture at all: a lens in the middle of the screen, and the sprite slides through it. See its own page.They are the same four curves a line of text has (TEXT_BULGE, TEXT_LEAN_BACK and the rest), with names that say what is being drawn. A TEXT_ name in a sprite call is a mistake, and the checker tells you so.
depth says how much, as a whole number. A number past the top is held to the top, and a number below 0 is read as 0.
0 draws the plain, flat sprite and costs nothing. A variable can switch the curve on and off.1, 2 and 3 are a gentle curve, a stronger one and a deep one. The far edge of the picture is drawn at about 80%, 67% and 57% of its width. Depth 3 looks like a barrel.

The same bulge at every depth, from flat on the left to depth 3 on the right.


The same call with only depth changing (the line under the picture says which): twelve real pictures played in a loop, each held for about a third of a second. The plain lighthouse on the left never changes. A viewer that does not animate shows the first frame.
Why only 3? The deeper curves of draw_text_3d (depths 4, 5 and 6) are made for letters. Letters stop a few rows short of the top and bottom of their box, so a curve can squeeze those empty rows as hard as it likes. A picture that runs right to the edge of its box would have its edges squeezed into thin slivers, so a bulge or a lean on a sprite is held to depth 3. The one exception is SPRITE_DRUM: there depth goes up to 6, because it is the width of a lens fixed on the screen and does not care what the picture is.
The shrinking is real, not a trick of the art. Every row of the screen is drawn at its own size, and every row of the picture is still shown. It is squeezed into fewer rows toward the curved edges and never cut, so the sprite comes out a little shorter than the flat one, never taller. The curve runs from the middle of the picture to its edge, and it follows the sprite up and down the screen to the nearest two rows.
Sprites that are 8, 16, 32 or 64 pixels tall work. A bigger picture is made of several sprites, and would need several calls.
It is for a sprite you draw with this call, not for an object's own sprite when it draws itself, and it does not turn the picture: there is no angle. To change the size of it, use draw_sprite_3d_scaled.
Exactly what a 3D text costs, out of the same pool. A 3D sprite uses one of the 32 matrices and two of the 8 row-by-row effects the console has, and 640 bytes of memory, for as long as the call keeps being made. Nothing in the cartridge: there is no new table, and a game that never calls this does not carry the code.
A room change keeps two of the eight row-by-row effects for itself, so there are six left for you:
draw_text_3d line, or a sprite and two lines, or three lines;draw_sprite_ripple takes one each);A sky from screen_backdrop takes one of the six too, and the game counts them all together, so a room change always has its two. A fourth 3D thing does not fit, and the console will not draw it curved.
Ask for more than there is and the game stops, in a development build, with a message that names every call holding a slot - they are numbered from 0 in the order they are written in an object's event, a 3D sprite is named by where it is drawn and a 3D text by its first letters. The sprite has already been drawn flat when it stops, and a release build, which has no such stop, simply shows it flat. The curve never fails to appear: you are told.
The 160 rows of numbers are worked out in memory, not read from the cartridge. They are worked out again only on a frame where the sprite moved up or down two rows, or its shape or depth changed. That takes about 11,000 cycles, which is 4% of one frame (the console has about 280,000 to spend on a frame). A sprite that sits still, or only moves sideways, costs nothing after its first frame.
draw_sprite_3d(spr_doc_tower, x, y, 0, SPRITE_BULGE, 3);The tower, bulging like a barrel, at depth 3.
var tilt = 0;
if (btn_held(BTN_A)) { tilt = 3; }
draw_sprite_3d(spr_doc_tower, x, y, 0, SPRITE_LEAN_BACK, tilt);A sprite that leans back only while A is held. With tilt at 0 it is the plain flat sprite and the effect costs nothing; the moment it becomes 3 the top of the picture sweeps away from you.
draw_sprite_3d(spr_doc_tower, x, y + wave(-40, 40, 120, 0), 0, SPRITE_DRUM, 3);The tower sliding up and down through a lens in the middle of the screen, getting smaller as it nears the top or the bottom of it. See SPRITE_DRUM.
Costs ONE of the hardware’s 32 affine matrices and TWO of the console’s 8 row-by-row (H-Blank) effects, for as long as the call keeps being made, plus 640 bytes of memory (nothing in the cartridge) and about 11,000 cycles (4% of a frame) on a frame where it moved up or down two rows or changed size, shape or depth. That is exactly what a 3D text costs, out of the same pool: a room transition keeps two of the eight for itself, so at most three 3D things (a text or a sprite) fit on screen at once, and a rippling sprite takes one of the same six. Asking for more than there is stops the game with a message that names every call holding a slot (the plain sprite has already been drawn when it stops, and a release build, which has no such stop, simply draws it flat). depth 0 draws a plain sprite and costs nothing. A bulge or a lean is held to depth 3 (a bigger number is treated as 3): the deeper curves of draw_text_3d are made for letters, which leave empty rows above and below them, and would crush a picture that runs to the edge of its box. The curve runs from the middle of the picture to its edge and follows the sprite to the nearest two rows. Every row of the picture is still drawn - it is squeezed into fewer rows of the screen, not cut - so the sprite comes out a little shorter than the plain one, never taller. Sprites 8, 16, 32 and 64 pixels tall work. With SPRITE_DRUM the lens belongs to the screen, not to the sprite: a sprite whose middle is outside the lens is not drawn at all (it keeps its matrix and its two row-by-row effects until you stop calling), and depth is how tight the lens is. The sprite is not turned or tinted: use draw_sprite_3d_scaled to change its size.